import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  async rewrites() {
    return [
      {
        source: '/api/v1/:path*',
        destination: 'http://localhost:8000/api/v1/:path*', // 后端API运行在8000端口，带api前缀
      },
      {
        source: '/v1/:path*',
        destination: 'http://localhost:8000/api/v1/:path*', // 兼容不带api前缀的路径
      },
      {
        source: '/auth/:path*',
        destination: 'http://localhost:8000/api/auth/:path*', // 处理其他auth相关接口
      },
    ];
  },
};

export default nextConfig;
